package class_object

/**
 * Created by SEELE on 2017/7/13.
 *
 */
open class Person {

    var cloth: Clothes? = null

    var name: String? = "default_name"
        get() = field
        set(value) {
            field = value
        }

    fun getNameLength(): Int {
        return name?.length ?: 2

    }

    fun getClothes(): String {
        return cloth?.name ?: "Naked"
    }

    var age: Int = 0
        set(value) {
            field = value
        }
        get() = field


    var id: String = ""

    val isEmpty get() = this.name == null

    override fun toString(): String {
        return "name=$name,age=$age,id=$id"
    }

    companion object {
        fun foo() {
            println("foo function")
        }
    }
}